import userlist from "@/router/users/userlist"; // 用户列表
import useradd from "@/router/users/useradd"; // 添加用户
import bookslist from "@/router/books/bookslist"; // 图书列表
import booksadd from "@/router/books/booksadd"; // 图书入库
import booksdellist from "@/router/books/booksdellist"; // 图书删除列表
import catelist from "@/router/bookcates/catelist"; // 分类列表
import cateadd from "@/router/bookcates/cateadd"; // 添加分类
import avatar from "@/router/person/avatar"; // 修改头像
import userinfo from "@/router/person/userinfo"; // 用户信息
import Layout from "@/Layout";

export const asyncRoutes = {
	userlist,
	useradd,
	bookslist,
	booksadd,
	booksdellist,
	catelist,
	cateadd,
	avatar,
	userinfo
}

export const asyncRoutes2 = {
	'用户管理': [
		userlist,
		useradd,
	],
	'图书管理': [
		bookslist,
		booksadd,
		booksdellist,
	],
	'分类管理': [
		catelist,
		cateadd,
	],
	'个人中心': [
		avatar,
		userinfo
	]
}

let aroutes = []
for (let key in asyncRoutes2){
// 在这里对所有的asyncRoutes进行处理
	aroutes.push({
		path: '/',
		component: Layout,
		redirect: asyncRoutes2[key][0].path,
		children: asyncRoutes2[key],
		meta: {
			title: key
		}
	})
}

export default aroutes
